package com.ruoyi.oss.service;

import java.util.List;
import java.util.Map;
import java.util.function.Function;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.multipart.MultipartFile;

import com.returns.value.ICodeAndData;
import com.ruoyi.oss.dto.OssCallbackResult;
import com.ruoyi.oss.dto.OssPolicyResult;


/**
 * Oss对象存储管理Service Created by macro on 2018/5/17.
 */
public interface OssService {
//	/**
//	 * Oss上传策略生成
//	 */
//	public <V> String policy(Function<V, String> function, String fileName);
//
//	/**
//	 * Oss上传成功回调
//	 */
//	OssCallbackResult callback(HttpServletRequest request);
//
//	public <V> String uploadSegment(Function<V, String> function, String fileName, IUploadSegment uploadSegment ) ;
//	
//	
//	/**
//	 * 合并段
//	 * @param <V>
//	 * @param function
//	 * @param fileName
//	 * @param uploadSegment
//	 * @return
//	 */
//	public <V> String mergeSegment(Function<V, String> function, IUploadId uploadSegment ) ;
//	
//	/**
//	 * 列举已上传段
//	 * @param <V>
//	 * @param function
//	 * @param fileName
//	 * @param uploadSegment
//	 * @return
//	 */
//	public <V> String listAlreadyUploadSegment(Function<V, String> function, IUploadId uploadSegment ) ;
//	
//	
//	public <V> ICodeAndData<String> uploadSegmentCheckFileHeader(Function<V, String> function, String fileName, IUploadSegmentCheckFileHeader uploadSegment ) ;
//
//
//	/**
//	 * 上传及验证视频
//	 * @param <V>
//	 * @param function
//	 * @param fileName
//	 * @param uploadSegment
//	 * @return
//	 */
//	public <V> ICodeAndData<String> uploadSegmentCheckFileHeaderVideo(Function<V, String> function, String fileName, IUploadSegmentCheckFileHeader uploadSegment ) ;
//
//	
//	/**
//	 * 构建分片上传
//	 * @param <V>
//	 * @param function
//	 * @param fileName
//	 * @param uploadSegment
//	 * @return
//	 */
//	public <V> SectionVO uploadSegmentBuild(Function<V, String> function, IUploadSegment uploadSegment );
//	
//	<V> ICodeAndData<String> uploadFileToOSS(InputStream inputStreamSource, String fileName,
//			Function<V, String> function, long totalSize);
//
//	<V> ICodeAndData<String> uploadFileToOSS(InputStream inputStreamSource, String fileName,
//			Function<V, String> function, long totalSize, String suffix);
	
	/**
     * Oss上传策略生成
     */
	OssPolicyResult policy();
	
	/**
	 * 签名URL
	 * @param <V>
	 * @param fileName
	 * @param path
	 * @return 
	 */
	public <V> ICodeAndData<Map<String, Object>> signURL(String fileName, String type, Function<V, String> path);
	
    /**
     * Oss上传成功回调
     */
    OssCallbackResult callback(HttpServletRequest request);
    
    /**
     * 
     * @param <V>
     * @param function 获取前缀文件夹
     * @param file
     * @return
     */
    <V> ICodeAndData<String> uploadFileNFT(Function<V, String> function,  MultipartFile file);

	Integer deleteFileToOSS(List<String> fileItems);
}
